//返回顶部
var t = document.querySelector("#toTop");

window.onscroll = function() {
	if(document.documentElement.scrollTop > 500 || document.body.scrollTop > 500) {
		t.style.display = "block";
	} else {
		t.style.display = "none";
	}
	
	//顶部固定
	var navbar = document.querySelector(".navbar");
	if(document.documentElement.scrollTop > 85 || document.body.scrollTop > 85) {
		navbar.style.top = "0px";
	} else {
		navbar.style.top = "85px";
	}

}

t.addEventListener('click', function() {
	window.scrollTo({
		top: 0,
		behavior: 'smooth'
	})
})
//返回顶部






//点击客服

var kefu = document.querySelector("#kefu");

var k_content = document.querySelector(".kefu-content");

var k_x = document.querySelector("#x");


kefu.addEventListener("click" ,function(){
	k_content.style.display = "block";
})

k_x.addEventListener("click" , function(){
	k_content.style.display = "none";
})




//硬件下滑

var dt_nav_btn = document.querySelectorAll("#dt_nav_btn");

var dt_nav_content = document.querySelectorAll("#dt_nav_content");

//移进事件

for(var i = 0; i < dt_nav_btn.length; i++) {
	dt_nav_btn[i].addEventListener("mouseover", function() {
		this.parentElement.lastElementChild.style.display = 'block';
	})

	for(var k = 0; k < dt_nav_btn.length; k++) {
		dt_nav_content[k].addEventListener("mouseleave", function() {
			this.parentElement.lastElementChild.style.display = 'none';
		})
	}
}



//登录下滑菜单
var dv_nav_btn = document.querySelectorAll("#dv_nav_btn");

var dv_nav_content = document.querySelectorAll("#dv_nav_content");

//移进事件

for(var i = 0; i < dv_nav_btn.length; i++) {

	dv_nav_btn[i].addEventListener("mouseover", function() {
		console.log("移进了");
		for(var k = 0; k < dv_nav_content.length; k++) {
			dv_nav_content[k].style.display = "block";
		}
	});
	//移出事件
	for(var k = 0; k < dv_nav_content.length; k++) {
		dv_nav_content[k].addEventListener("mouseleave", function() {
			console.log("移出了");
			this.style.display = "none";
		})
	}

}

//点击视频
var video = document.querySelector(".video");

var flose = document.querySelector(".window-btn>img")

var btn = document.querySelector(".main-show");

btn.addEventListener("click", function() {
	video.style.display = "block";
	flose.style.display = "block";
})

flose.addEventListener("click", function() {
	video.style.display = "none";
})




//底部点击

var up = document.querySelectorAll("#f-n");

var down = document.querySelectorAll(".f-i-s-t");

console.log(up);
console.log(down);

for(var asd = 0; asd < up.length; asd++) {
	up[asd].bool = true;
	up[asd].index = asd;
	up[asd].addEventListener("click", function() {
		if(this.bool) {
			for(var as = 0; as < up.length; as++) {
				down[this.index].style.display = "block";
				up[this.index].style.transform = "rotateZ(180deg)";

			}
		} else {
			for(var as = 0; as < up.length; as++) {
				down[this.index].style.display = "none";
				up[this.index].style.transform = "rotateZ(0deg)";
			}
		}
		this.bool = !this.bool;
	})
}


